package com.only4play.authcenter.constants;

import com.only4play.common.constants.BaseEnum;

import java.util.Optional;

/**
 * @author hinzzz www.hinzzz.cn 157957329@qq.com
 * 2024-03-04
 */
public enum ApplicationType implements BaseEnum<ApplicationType> {

    H5(1, "H5"),
    WEB(2, "WEB"),
    APP(3, "APP"),
    ;

    private final Integer code;
    private final String name;
    ApplicationType(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static Optional<ApplicationType> of(Integer code) {
        return Optional.ofNullable(BaseEnum.parseByCode(ApplicationType.class, code));
    }

    @Override
    public Integer getCode() {
        return this.code;
    }

    @Override
    public String getName() {
        return this.name;
    }

}
